package com.example.baojin.controller;

import com.example.baojin.pojo.baojin;
import com.example.baojin.service.ToService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
public class controller {

    @Autowired
    private ToService toService;

    @GetMapping("/{count}")
    public String updata1(@PathVariable("count") Long count) {
        if(count == 1){
            updata();
        }
        if (count == 2){
            updata();
            updata2();
        }
        if (count == 3){
            updata();
            updata2();
            updata3();
        }
        if (count == 4){
            updata();
            updata2();
            updata3();
            updata4();
        }
        if (count == 5){
            updata();
            updata2();
            updata3();
            updata4();
            updata5();
        }
        if (count == 6){
            updata();
            updata2();
            updata3();
            updata4();
            updata5();
            updata6();
        }
        if (count == 7){
            updata();
            updata2();
            updata3();
            updata4();
            updata5();
            updata6();
            updata7();
        }
        return "修改成功";
    }


    @GetMapping("/bug1")
    public String updata() {
        toService.select();
        return "修改成功";
    }

    @GetMapping("/bug2")
    public String updata2() {
        toService.select2();
        return "修改成功";
    }

    @GetMapping("/bug3")
    public String updata3() {
        toService.select3();
        return "修改成功";
    }

    @GetMapping("/bug4")
    public String updata4() {
        toService.select4();
        return "修改成功";
    }

    @GetMapping("/bug5")
    public String updata5() {
        toService.select5();
        return "修改成功";
    }

    @GetMapping("/bug6")
    public String updata6() {
        toService.select6();
        return "修改成功";
    }

    @GetMapping("/bug7")
    public String updata7() {
        toService.select7();
        return "修改成功";
    }
}
